export default {
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      isInit: true
    }
  },
  computed: {
    innerVisible: {
      get () {
        return this.value
      },
      set (val) {
        this.$emit('input', val)
      }
    }
  },
  watch: {
    value (val) {
      this.innerVisible = val
      if (val && this.modalUpdated) { // 每次弹框显示时需要调用的方法
        this.modalUpdated()
      }
      if (val && this.isInit && this.modalInit) {
        this.$nextTick(() => { // 确保loading的z-index大于弹框
          this.modalInit()
          this.isInit = false
        })
      }
    }
  }
}
